//leetcode第53题，最大子数组和
class Solution {
public:
    int maxSubArray(vector<int>& nums) {
        long long maxsum=0;
        long long temp=nums[0];
        for(int num:nums)
        {
            if(maxsum>0)maxsum+=num;
            else maxsum=num;
            temp=max(temp,maxsum);
        }
        return temp;
    }
};
